﻿using Coolzon.UI.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace Coolzon.UI.Charts.Widgets
{
    public partial class DataChartBase
    {
        protected Visifire.Charts.Title GetTitle()
        {
            Visifire.Charts.Title title = new Visifire.Charts.Title();
            title.BorderColor = TitleBorderColor==null? null : TitleBorderColor;
            title.BorderThickness = TitleBorderThickness;
            title.Background = TitleBackground==null? null : TitleBackground;
            title.Enabled = TitleEnabled;
            title.Text = TitleText;
            title.FontFamily = TitleFontFamily;
            title.FontWeight = TitleFontWeight;
            title.FontSize = TitleFontSize;
            title.FontColor = TitleFontColor==null? null : TitleFontColor;
            title.HorizontalAlignment = TitleHorizontalAlignment;
            title.VerticalAlignment = TitleVerticalAlignment;
            title.DockInsidePlotArea = TitleDockInsidePlotArea;
            title.ShadowEnabled = TitleShadowEnabled;
            title.ToolTipText = TitleToolTipText;

            return title;
        }

        [Category("标题")]
        [DisplayName("标题边框颜色")]
        [Description("BorderColor")]
        ////[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BorderColor", "边框颜色")]
        public Brush TitleBorderColor
        {
            get
            {
                return titleBorderColor;
            }
            set
            {
                titleBorderColor = value;
                ////Refresh();
            }
        }
        private Brush titleBorderColor;

        [Category("标题")]
        [DisplayName("标题边框大小")]
        [Description("BorderThickness")]
        ////[Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BorderThickness", "边框大小")]
        public Thickness TitleBorderThickness
        {
            get
            {
                return borderThickness;
            }

            set
            {
                borderThickness = value;
                ////Refresh();
            }
        }
        private Thickness borderThickness;

        [Category("标题")]
        [DisplayName("标题背景颜色")]
        [Description("Background")]
        ////[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "Background", "背景颜色")]
        public Brush TitleBackground
        {
            get
            {
                return background;
            }

            set
            {
                background = value;
                ////Refresh();
            }
        }
        private Brush background;

        [Category("标题")]
        [DisplayName("标题是否可用")]
        [Description("Enabled")]
        ////[Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "Enabled", "是否可用")]
        public bool TitleEnabled
        {
            get
            {
                return enabled;
            }

            set
            {
                enabled = value;
                ////Refresh();
            }
        }
        private bool enabled;

        [Category("标题")]
        [DisplayName("标题文本")]
        [Description("Text")]
        ////[Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "Text", "文本")]
        public string TitleText
        {
            get
            {
                return titleText;
            }

            set
            {
                titleText = value;
                ////Refresh();
            }
        }
        private string titleText;

        [Category("标题")]
        [DisplayName("标题字体")]
        [Description("FontFamily")]
        ////[Editor(typeof(UI.XProperty.Editors.XFontFamilyEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "FontFamily", "字体")]
        public FontFamily TitleFontFamily
        {
            get
            {
                return titleFontFamily;
            }

            set
            {
                titleFontFamily = value;
                ////Refresh();
            }
        }
        
        [Category("标题")]
        [DisplayName("标题字体粗细")]
        [Description("FontWeight")]
        ////[Editor(typeof(UI.XProperty.Editors.XFontWeightEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "FontWeight", "字体粗细")]
        public FontWeight TitleFontWeight
        {
            get
            {
                return titleFontWeight;
            }

            set
            {
                titleFontWeight = value;
                ////Refresh();
            }
        }

        [Category("标题")]
        [DisplayName("标题字体大小")]
        [Description("FontSize")]
        ////[Editor(typeof(UI.XProperty.Editors.XIntEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "FontSize", "字体大小")]
        public int TitleFontSize
        {
            get
            {
                return titleFontSize;
            }

            set
            {
                titleFontSize = value;
                ////Refresh();
            }
        }

        [Category("标题")]
        [DisplayName("标题字体颜色")]
        [Description("FontColor")]
        ////[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "FontColor", "字体颜色")]
        public Brush TitleFontColor
        {
            get
            {
                return titleFontColor;
            }

            set
            {
                titleFontColor = value;
                ////Refresh();
            }
        }

        [Category("标题")]
        [DisplayName("标题水平对齐")]
        [Description("HorizontalAlignment")]
        ////[Editor(typeof(UI.XProperty.Editors.XHorizontalAlignmentEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "HorizontalAlignment", "水平对齐")]
        public HorizontalAlignment TitleHorizontalAlignment
        {
            get
            {
                return titleHorizontalAlignment;
            }

            set
            {
                titleHorizontalAlignment = value;
                ////Refresh();
            }
        }

        [Category("标题")]
        [DisplayName("标题垂直对齐")]
        [Description("VerticalAlignment")]
        ////[Editor(typeof(UI.XProperty.Editors.XVerticalAlignmentEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "VerticalAlignment", "垂直对齐")]
        public VerticalAlignment TitleVerticalAlignment
        {
            get
            {
                return titleVerticalAlignment;
            }

            set
            {
                titleVerticalAlignment = value;
                ////Refresh();
            }
        }

        [Category("标题")]
        [DisplayName("标题是否显示在数据区域内")]
        [Description("DockInsidePlotArea")]
        ////[Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "DockInsidePlotArea", "是否显示在数据区域内")]
        public bool TitleDockInsidePlotArea
        {
            get
            {
                return titleDockInsidePlotArea;
            }

            set
            {
                titleDockInsidePlotArea = value;
                ////Refresh();
            }
        }

        [Category("标题")]
        [DisplayName("标题是否显示标题阴影")]
        [Description("TitleShadowEnabled")]
        ////[Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "TitleShadowEnabled", "是否显示标题阴影")]
        public bool TitleShadowEnabled
        {
            get
            {
                return titleShadowEnabled;
            }

            set
            {
                titleShadowEnabled = value;
                ////Refresh();
            }
        }

        [Category("标题")]
        [DisplayName("标题提示")]
        [Description("TitleShadowEnabled")]
        ////[Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "TitleShadowEnabled", "标题提示")]
        public string TitleToolTipText
        {
            get
            {
                return titleToolTipText;
            }

            set
            {
                titleToolTipText = value;
                ////Refresh();
            }
        }

        private bool titleShadowEnabled;
        private string titleToolTipText;

        private FontFamily titleFontFamily;
        private FontWeight titleFontWeight;
        private int titleFontSize;
        private Brush titleFontColor;
        private HorizontalAlignment titleHorizontalAlignment;
        private VerticalAlignment titleVerticalAlignment;
        private bool titleDockInsidePlotArea;

    }
}
